﻿@using System.Globalization
@using Mes5GService
@using Mes5GService.Localization
@using Mes5GService.Web.Resources
@model Mes5GService.Web.Models.Stripe.StripePurchaseViewModel
@inject IWebResourceManager WebResourceManager
@{
    Layout = "~/Views/Account/_Layout.cshtml";
    ViewBag.DisableTenantChange = true;
}

@section Scripts
{
    <script src="https://js.stripe.com/v3"></script>
    <script abp-src="/view-resources/Views/Stripe/_StripeRedirectToSession.js" asp-append-version="true"></script>
}

@section Styles{
    <link href="/metronic/common/css/login-1@(CultureHelper.IsRtl ? ".rtl":"").css" rel="stylesheet" />
}

<div class="login-form">
    <div class="pb-13 pt-lg-0 pt-5">
        <h3 class="font-weight-bolder text-dark font-size-h4 font-size-h1-lg">
            @L("Purchase")
        </h3>
    </div>
    <hr class="border-green" />
    <div class="form-actions">
        <div class="form-group row">
            <label class="col-sm-4 control-label">@L("Item")</label>
            <div class="col-sm-8 text-right">
                <p class="form-control-static text-bold">
                    @Model.Description
                </p>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-4 control-label">@L("Price")</label>
            <div class="col-sm-8 text-right">
                <p class="form-control-static text-bold" id="totalPrice">
                    @AbpZeroTemplateConsts.CurrencySign@(Model.Amount.ToString("N2"))
                </p>
            </div>
        </div>
        @if (Model.IsRecurring)
        {
            if (Model.UpdateSubscription)
            {
                <div class="form-group row">
                    <label class="col-sm-12 control-label">@L("RecurringSubscriptionUpgradeNote")</label>
                </div>
            }
            else
            {
                <div class="form-group row">
                    <div class="col-sm-12 text-right">
                        <p class="form-control-static text-bold" id="totalPrice">
                            @L("AutomaticBilling")
                        </p>
                    </div>
                </div>
            }
        }
    </div>

    <input type="hidden" id="sessionId" value="@Model.SessionId" />
    <input type="hidden" id="stripePublishableKey" value="@Model.Configuration.PublishableKey" />

    <button id="stripe-checkout" class="btn btn-primary btn-block">@L("Purchase")</button>
</div>
